package gps

import (
	"fmt"
	"gitee.com/injoyai/goutil/conv"
	"gitee.com/injoyai/goutil/net/http"
)

// Site 根据坐标获取位置信息,用的是公开的api
func Site(lng, lat float64) (string, error) {
	key := "6IDBZ-VU4YX-WXO4Y-ZV7DN-YFPDT-QYFL4"
	url := fmt.Sprintf("https://apis.map.qq.com/ws/geocoder/v1/?location=%f,%f&key=%s", lat, lng, key)
	resp := http.Url(url).Get()
	return conv.NewMap(resp.GetBody()).GetString("result.address"), resp.Err()
}
